import type { LocationQuery } from 'vue-router';

const convertQuery = (
  query: LocationQuery,
  numberKeys: string[],
) => Object.keys(query).reduce((acc, item) => {
  if (query[item]) acc[item] = numberKeys.includes(item) ? Number(query[item]) : `${query[item]}`;
  return acc;
}, {} as Record<string, number | string>);

export default convertQuery;
